<?php
/**
 * Created by PhpStorm.
 * User: 异步加载
 * Date: 2018/1/2
 * Time: 16:06
 */

namespace app\api\controller\v1;
use app\api\model\Goods as GoodsModel;
use app\lib\exception\ParameterException;

class Goods
{
    /**
     * @return \think\response\Json
     * @throws ParameterException
     * 获取上新商品
     */
    public function getNewGoods(){
        $goods = GoodsModel::getNewGoods();
        if(!$goods){
            throw new ParameterException();
        }
        return json($goods,200);
    }
}